import React from 'react'
import ReactDOM from 'react-dom'
import Graph from '../../component/Graph/Graph'
import './css/RelationGraph.css'

class RelationGraph extends React.Component {
    componentWillMount = () => {}
    constructor(props) {
        super(props)
        this.state = {}
    }

    componentDidMount = () => {}

    getGraphData = (params) => {
        this.props.onChange && (this.props.onChange({dep_type: params.data.dep_type, id: params.data.id, name: params.data.name, origin_id: params.data.origin_id, pid: params.data.pid}))
    }
    graphConfig = {
        blockStyle:{
            h:50,  
            w:110, 
            fontSize:15
        },
        key: 's_department_flood_info', //数据来源
        firstTreeClick: (params) => { //一级和二级节点点击事件
            this.getGraphData(params)
        },
        secTreeClick: (params) => { //三级节点点击事件
            this.getGraphData(params)
        },


    }
    render() { 
        return (
            <div className='RelationGraph' style={{top:( document.documentElement.clientHeight || document.body.clientHeight)/2,marginTop:'-200px'}} >
                <Graph config={this.graphConfig}></Graph>
            </div>
        )
    }
}
export default RelationGraph